<%@ page contentType="text/html;charset=UTF-8" language="java"%>
<%@ page import="com.request.DBUtils"%>
<%@ page import="com.request.Request"%>

<!DOCTYPE html>
<html>
<head>
<title>Edit Entry</title>
<link href="css/bootstrap.css" rel="stylesheet">
<script>
	function validateform() {
		if (document.frm.name.value == "") {
			alert("Please enter your name!");
			document.frm.name.focus();
			return false;
		}

		if (document.frm.email.value == "") {
			alert("Please enter your email!");
			document.frm.email.focus();
			return false;
		}

		if (document.frm.university.value == "") {
			alert("Please enter your University/Company Name!");
			document.frm.university.focus();
			return false;
		}

	}
</script>
</head>
<body>
	<%
		String k = request.getParameter("id");
		Long id = Long.valueOf(k);
		Request r = DBUtils.retrieve(id);
	%>
	<form name="frm" method="post" action="processedit.jsp?id=<%=id%>"
		class="form-horizontal" onSubmit="return validateform()">
		<fieldset>
			<legend>Edit Entry</legend>
			<br /> <br />
			<div class="control-group">
				<label class="control-label" for="name">Name <h id="asterik">*</h></label>
				<div class="controls">
					<input type="text" name="name" value="<%=r.getName()%>" />
				</div>
			</div>
			<br /> <br />
			<div class="control-group">
				<label class="control-label" for="university">University/Company
					<h id="asterik">*</h>
				</label>
				<div class="controls">
					<input type="text" name="university" value="<%=r.getUniversity()%>" />
				</div>
			</div>
			<br /> <br />
			<div class="control-group">
				<label class="control-label" for="email">Email <h
						id="asterik">*</h></label>
				<div class="controls">
					<input type="email" name="email" value="<%=r.getEmail()%>" />
				</div>
			</div>
			<br /> <br />
			<div class="control-group">
				<label class="control-label" for="feedback">Purpose of
					request/Feedback</label>
				<div class="controls">
					<textarea name="feedback" class="input-xlarge" id="textarea"
						rows="3"><%=r.getComment()%></textarea>
				</div>
			</div>
			<br /> <br />
			<div class="form-actions">
				<button type="submit" class="btn btn-primary">Submit</button>
			</div>

		</fieldset>
	</form>
</body>
</html>